<?php

namespace Database\Seeders;

use Illuminate\Database\Seeder;
use App\Models\User;
class UserSeeder extends Seeder
{
    /**
     * Run the database seeds.
     *
     * @return void
     */
    public function run()
    {
        //清空数据表
        User::truncate();
        //填充50条数据
        User::factory()
            ->count(50)
//            ->hasPosts(1)
            ->create();
        //修改id等于1的用户名为admin
        User::where('id',1)->update(['username'=>'admin']);
    }
}
